/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import com.nokia.maps.map.MapCanvas;
import com.nokia.maps.common.*;
/**
 * @author juksilve
 */
public class MyMapCanvas extends MapCanvas implements CommandListener{

    private final Command EXIT = new Command("Exit", Command.EXIT, 1);
    protected MIDlet midlet; // for notifyDestroyed
    
    public MyMapCanvas(Display display, MIDlet midlet) {
        super(display);

        this.midlet = midlet;
        addCommand(EXIT);
        setCommandListener(this);
        
        getMapDisplay().setZoomLevel(10, 0, 0);    
        getMapDisplay().setCenter(new GeoCoordinate(52.5, 13.4, 0));
    }
    
    public void commandAction(final Command c, Displayable d) {
        if (c == EXIT) {
            midlet.notifyDestroyed();
        } else {
            commandRun(c);
        }
    }
    
    protected void commandRun(Command c) {
    
      //  handle any other command
    }

    public void onMapUpdateError(String string, Throwable thrwbl, boolean bln) {
        // add code for update error handling
    }

    public void onMapContentComplete() {
        // add code for content updated handling
    }
}
